//
//  MIDIactivityController.m
//  迷笛
//
//  Created by . on 2018/9/10.
//  Copyright © 2018年 🍃🌺🌺🍃. All rights reserved.
//

#import "MIDIactivityController.h"
#import "MIDIlactiviViewCell.h"
@interface MIDIactivityController ()<UITableViewDelegate,UITableViewDataSource>
@property(nonatomic,strong)UITableView * Hottable;

@end

@implementation MIDIactivityController

- (void)viewDidLoad {
    [super viewDidLoad];
    UIBarButtonItem *leftBarItem = [[UIBarButtonItem alloc] initWithTitle:nil style:UIBarButtonItemStylePlain target:self action:@selector(Block:)];
    self.navigationItem.leftBarButtonItem = leftBarItem;
    
    [self.navigationItem.leftBarButtonItem setImage:[[UIImage imageNamed:@"后退"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
    self.view.backgroundColor =[UIColor colorWithHexString:@"#1B212F"];
    
    [self HomeUI];

}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section;
{
    return 15;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;
{
    static NSString * cellID = @"cell";
    MIDIlactiviViewCell * cell =[tableView dequeueReusableCellWithIdentifier:cellID];
    if (!cell)
    {
        cell = [[MIDIlactiviViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellID];
        cell.backgroundColor = [UIColor colorWithHexString:@"#1B212F"];
        cell.selectionStyle=UITableViewCellSelectionStyleNone;

    }
    cell.maniniamge.image =[UIImage imageNamed:@"IMG_0195.jpg"];
    cell.address.text = @"2018北部湾（钦州）迷笛音乐节带你“玩音乐...";
    cell.day.text = @"倒计时:3天";
    cell.coordinates.text = @"上海";
    cell.time.text = @"2017/4/21-2017/4/22";
    
    return cell;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return kDevice_Is_iPhoneX?HeighX(240):HeightScale(236);
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return kDevice_Is_iPhoneX?HeighX(10):HeightScale(10);
}
- (nullable UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section;
{
    return nil;
}
- (nullable UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section;
{
    return nil;
}
-(void)HomeUI
{
    [self.view addSubview:self.Hottable];
}
-(UITableView *)Hottable
{
    if (!_Hottable)
    {
        _Hottable = [[UITableView alloc]initWithFrame:CGRectMake(0, kDevice_Is_iPhoneX?HeighX(0):HeightScale(0), self.view.frame.size.width,   kDevice_Is_iPhoneX?HeighX(self.view.frame.size.height-50):HeightScale(self.view.frame.size.height-50)) style:UITableViewStyleGrouped];
        _Hottable.dataSource = self;
        _Hottable.delegate = self;
        _Hottable.backgroundColor = [UIColor colorWithHexString:@"#1B212F"];
        _Hottable.separatorStyle = UITableViewCellSeparatorStyleNone;
    }
    return _Hottable;
}
// 返回上一级
-(void)Block:(UIButton * )sender
{
    [self.navigationController popViewControllerAnimated:YES];
}
- (void)viewWillAppear:(BOOL)animated
{
    self.tabBarController.tabBar.hidden = YES;
    self.navigationController.navigationBar.translucent = NO;//Bar的模糊效果，默认为YES
    
    self.navigationController.navigationBar.barTintColor = [UIColor colorWithHexString:@"#171717"];
    self.title = @"活动日程";
    [self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor colorWithHexString:@"#FFFFFF"],NSFontAttributeName : [UIFont fontWithName:@"Helvetica-Bold" size:WidthScale(17)]}];
    //    去掉导航黑线
    UIImage *img = [UIImage imageNamed:@""];
    [self.navigationController.navigationBar setBackgroundImage:img  forBarMetrics:UIBarMetricsDefault];
    self.navigationController.navigationBar.shadowImage = [[UIImage alloc] init];
}
@end
